package com.example.demo.controller;

import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.example.demo.entity.User;
import com.example.demo.service.db1.Db1Service;
import com.example.demo.service.db2.Db2Service;

@RestController
public class Contorller {

	@Autowired
	public Db1Service db1service;
	
	@Autowired
	public Db2Service db2service;
	
	@RequestMapping("/hello1")
	public User selectUser1() {
		return db1service.selectuser();
	}
	
	@RequestMapping("/add1")
	public Map<String,Object> add1(User user) {
		return db1service.insert(user);
	}
	
	@RequestMapping("/hello2")
	public User selectUser2() {
		return db2service.selectuser();
	}
	
	@RequestMapping("/add2")
	public Map<String,Object> add2(User user) {
		return db2service.insert(user);
	}
}
